﻿@extends('common.header')

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="white">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="csrf-token" content="{{ csrf_token() }}">
	<title>{{ $tdk->title }}{{ $webConfig->webName }}</title>
	<meta name="Keywords" content="{{ $tdk->keywords }}" />
	<meta name="Description" content="{{ $tdk->desc }}"/>
	<link rel="shortcut icon" href="{{ asset('/images/favicon.ico') }}" />
    <link rel="stylesheet" type="text/css" href="{{ asset('/css/newList/info_list.css') }}"/>
    <script src=" {{ asset('/js/jquery-1.8.3.min.js') }} "></script>
    <script type='text/javascript' >
        <!-- 2.设置全局ajax选项 -->
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        // 获取 token
        var _token = $('meta[name="csrf-token"]').attr('content');
		
		
		// 点赞
        function replyPraise( prefix,id,likeType )
        {
            var obj = $("#"+prefix+"_praise_"+id);
            var isPraise = obj.attr('isPraise');
            if (isPraise == 'false')
            {
                // 未点赞
                // 获取 现有 赞数
                var num = parseInt($("#"+prefix+"_praise_txt_"+id).text());
                // +1
                num += 1;
                $("#"+prefix+"_praise_txt_"+id).text(num);
                // 已赞图片
                $("#"+prefix+"_praise_img_"+id).attr("src", "{{ asset('/images/articles/yizan.png') }}");
                // 写进 数据库
                $.ajax({
                    type: "post",
                    url: "{{ url('/commentLike') }}/"+likeType,
                    data: {id: id, _token: _token},
                    async: false,
                    dataType: "json",
                    success: function (back)
                    {
                        // alert(back['show_info']);
                    }
                });
                // 设置为 已点赞
                obj.attr('isPraise', 'true');

            }else
            {
                // 已点赞
                $("#"+prefix+"_warn_"+id).html('');
                $("#"+prefix+"_warn_"+id).html('您已赞过');
                $("#"+prefix+"_warn_"+id).show();
                setTimeout(function(){
                    $("#"+prefix+"_warn_"+id).hide();
                },1000);
            }

        }
    </script>
	<script type='text/javascript' >
		// 收藏
	function collect( prefix,id,collectType )
	{
		var obj = $("#"+prefix+"_collect_"+id);
		var isCollect = obj.attr('isCollect');
		if (isCollect == 'false')
		{
			// 未收藏
			
			// 写进 数据库
			$.ajax({
				type: "post",
				url: "{{ url('/collect') }}/"+collectType,
				data: {id: id,_token: _token},
				async: false,
				dataType: "json",
				success: function (back)
				{
					
					if( back['show_info']!='' )
					{
						$("#"+prefix+"_warn_"+id).html('');
						$("#"+prefix+"_warn_"+id).html('您已收藏过');
						$("#"+prefix+"_warn_"+id).show();
						setTimeout(function(){
							$("#"+prefix+"_warn_"+id).hide();
						},1000);
						// 已收藏图片
						$("#"+prefix+"_collect_img_"+id).attr("src", "{{ asset('/images/articles/yicang.png') }}");
					}else
					{
						$("#"+prefix+"_warn_"+id).html('');
						$("#"+prefix+"_warn_"+id).html('收藏成功');
						$("#"+prefix+"_warn_"+id).show();
						setTimeout(function(){
							$("#"+prefix+"_warn_"+id).hide();
						},1000);
						// 已收藏图片
						$("#"+prefix+"_collect_img_"+id).attr("src", "{{ asset('/images/articles/yicang.png') }}");
					}
					
				}
			});
			// 设置为 已收藏
			obj.attr('isCollect', 'true');
			
		}else
		{
			// 已收藏
			$("#"+prefix+"_warn_"+id).html('');
			$("#"+prefix+"_warn_"+id).html('您已收藏过');
			$("#"+prefix+"_warn_"+id).show();
			setTimeout(function(){
				$("#"+prefix+"_warn_"+id).hide();
			},1000);
			// 已收藏图片
			$("#"+prefix+"_collect_img_"+id).attr("src", "{{ asset('/images/articles/yicang.png') }}");
		}
	
	}
		
	
	</script>
</head>
<body style="background:#fff">

<!--面包屑导航-->
<div style="width: 1200px;height: 40px;line-height:40px;position: relative;margin: 110px auto 0">
    <ol style="float: left;overflow: hidden;color: #333;list-style: none;">
        <li style="float: left;margin-left: 5px">当前位置：</li>
        <li style="float: left;margin-left: 5px"><a href="{{ url('/') }}" style="color: #de1e30;margin-left: 5px">首页</a></li>
        <li style="float: left;margin-left: 5px"><a href="{{ url('/footClub') }}" style="color: #de1e30;margin-left: 5px">> 球吧</a></li>
    </ol>
</div>

<!-- 球吧 -->
<div class="info-area-big" style="overflow:hidden">
    <div class="info-area">
        <!--右侧推荐列表-->
        <div class="info-ranking-list">
            <div class="hotvideo">
                <div class="hottitle">热门文章</div>
                <div class="hotlist" style="height: 550px;">
                    <ul id="hotNew">
                        <!--热门文章列表-->
                        @forelse( $recommend as $key=>$recommend_info)
                        @if( $key==0 )
                        <li>
                            <a href="{{ url('/article') }}/{{ $recommend_info['id'] }}" class="leftlist_a">
                                <div class="hotlist_box hotlist_div on">
                                    <div class="hotimg">
                                        <img src="{{ $recommend_info['pic_url'] }}" title="{{ $recommend_info['title'] }}">
                                    </div>
                                    <div class="hotrtext comtext">{{ $recommend_info['title'] }}<br><a class="hotrtext-a" href="{{ url('/footClub') }}/{{ $recommend_info['cid'] }}">{{ $recommend_info['cate_info'] }}</a></div>
                                </div>
                            </a>
                        </li>
                        @else
                        <li>
                            <a href="{{ url('/article') }}/{{ $recommend_info['id'] }}" class="leftlist_a">
                                <div class="hotlist_box" id="add">
                                    <div class="hotimg">
                                        <img src="{{ $recommend_info['pic_url'] }}" title="{{ $recommend_info['title'] }}">
                                    </div>
                                    <div class="hotrtext comtext">{{ $recommend_info['title'] }}<br><a class="hotrtext-a" href="{{ url('/footClub') }}/{{ $recommend_info['cid'] }}">{{ $recommend_info['cate_info'] }}</a></div>
                                </div>
                            </a>
                        </li>
                        @endif
                        @empty
                        @endforelse
                    </ul>
                </div>
            </div>
        </div>
        <!--左侧发文列表-->
        <div class="info-list" style=";overflow:none;">
			<!--球吧 头部-->
            <div class="club-tit">
               
                <div class="club-tit-main club-tit-main1">
                    <a href="#" class="club-tit-a1">球吧</a>
                    <a href="#" class="club-tit-a2">帖子总数 :<span>{{ $articles_count }}</span></a>
                </div>
            </div>
			<!--球吧 分类 头部-->
            <div class="club-tit club-tit-fl">
                <div class="club-tit-main">
					<div class="jfb" id="recom_news" style="margin-top: -5px;">
					@if( $category_id == 16 )
						<a href="{{ url('/footClub') }}">全部</a>
						<a href="{{ url('/footClub') }}/16" class="hover"  >预测</a>
						<a href="{{ url('/footClub') }}/17">情报</a>
						<a href="{{ url('/footClub') }}/18">杂谈</a>
					@elseif( $category_id == 17 )
						<a href="{{ url('/footClub') }}">全部</a>
						<a href="{{ url('/footClub') }}/16">预测</a>
						<a href="{{ url('/footClub') }}/17" class="hover"  >情报</a>
						<a href="{{ url('/footClub') }}/18">杂谈</a>
					@elseif( $category_id == 18 )
						<a href="{{ url('/footClub') }}">全部</a>
						<a href="{{ url('/footClub') }}/16">预测</a>
						<a href="{{ url('/footClub') }}/17">情报</a>
						<a href="{{ url('/footClub') }}/18" class="hover"  >杂谈</a>
					@else
						<a href="{{ url('/footClub') }}" class="hover" >全部</a>
						<a href="{{ url('/footClub') }}/16">预测</a>
						<a href="{{ url('/footClub') }}/17">情报</a>
						<a href="{{ url('/footClub') }}/18">杂谈</a>
					@endif
					<!--我要发帖-->
					@if( session('user_name') )
					<a href="{{ url('/new_article') }}" class="club-tit-a6">我要发帖</a>
					@else
					<a id="clubLogin" href="#" class="club-tit-a6">我要发帖</a>
					@endif
						
					</div>
                </div>
            </div>
           
			@forelse( $page_articles as $key => $article_info )

			<!--球吧 全部 内容-->
			<div class="club_cont" style="display:block;">
				<!-- 图片 -->
				<a class="club_head_img" href="{{ url('/showcenter') }}/{{ $article_info['user_id'] }}" title="{{ $article_info['title'] }}">
					<img src="{{ $article_info['pic_url'] }}" alt="{{ $article_info['title'] }}" title="{{ $article_info['title'] }}"  />
				</a>
			
				
				<!-- 标题 -->
				<div class="club_head_tit" >
					
					<div class="club_head_tit_t">
						<div class="club_head_tit_fl">{{ $article_info['cate_info'] }}</div>
						<a href="{{ url('/article') }}/{{ $article_info['id'] }}" title="{{ $article_info['title'] }}" alt="{{ $article_info['title'] }}" >{{ $article_info['title'] }}</a>
					</div>
					
					<div class="club_head_tit_b">
				
						<!-- 用户名 -->
						<div class="club_head_username" style="width:auto;padding:0 5px;height:100%;float:left;margin-top: -3px;" >
							<a href="{{ url('/showcenter') }}/{{ $article_info['user_id'] }}" title="{{ $article_info['title'] }}" alt="{{ $article_info['title'] }}" ><i></i>{{ $article_info['username'] }}&nbsp;&nbsp;
							</a>
						</div>
						
						<div style="width:auto;padding:0 5px;height:100%;float:left;" >{{ $article_info['create_at'] }}&nbsp;&nbsp;&nbsp;</div>
						
						<div style="float:right">
							<!-- 点赞 -->
							<span id="article_warn_{{ $article_info['id'] }}"></span>
							<div class="reply-praise praise">
								<span id="article_praise_{{ $article_info['id'] }}" onclick="replyPraise('article',{{ $article_info['id'] }},2);" isPraise="false"  class="info-main-zan" >
									<img src="{{ asset('/images/articles/zan.png') }}" id="article_praise_img_{{ $article_info['id'] }}" />
								</span>
								<span id="article_praise_txt_{{ $article_info['id'] }}">{{ $article_info['good'] }}</span>
							</div>

							<!--评论-->
							<div class="reply-praise ">
								<span class="share"><img src="{{ asset('/images/articles/ping.png') }}" id="praise-img"/></span>
								<span class="share_number">{{ $article_info['comments_total'] }}</span>
							</div>
							
							<!-- 收藏 -->
							<div class="reply-praise ">
								<a href="#">
									@if( session('user_name') )
										<span id="article_collect_{{ $article_info['id'] }}" onclick="collect('article',{{ $article_info['id'] }},2);" style="display:inline-block;" isCollect='false' >
											<img src="{{ asset('/images/articles/cang.png') }}"  id="article_collect_img_{{ $article_info['id'] }}" style="width:15xp;height:15px"  >
										</span>		
									@else
										<span id="collectLogin"  >
											<img src="{{ asset('/images/articles/cang.png') }}" style="width:15xp;height:15px"  />
										</span>		
									@endif
											
								</a>
							</div>
						
						</div>
					
					</div>
				</div>
				</a>
			</div>
			@empty
				<!--没有搜索文章显示-->
				<div class="none_article">
					<img src="{{ asset('/images/articles/nothing.png') }}" alt="">
					<p>没有搜多到相关信息</p>
				</div>
            @endforelse	
        </div>
    </div>
</div>

<!-- 分页 -->
<div style="width:70%;text-align:center;font-size:14px;">
    {{ $all_articles -> appends(['keyTitle'=>$keyTitle]) ->links() }}
</div>

@extends('common.footer')

</body>
</html>